package com.hccl.config;


import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by Zhao on 2018/04/10.
 */

@Configuration
public class WebServletContextConfiguration extends WebMvcConfigurerAdapter {

    public void configureContentNegotiation(ContentNegotiationConfigurer configurer){

        configurer.favorParameter(true).parameterName("format").ignoreAcceptHeader(true).
                defaultContentType(MediaType.APPLICATION_JSON_UTF8).mediaType("xml",MediaType.APPLICATION_XML)
                .mediaType("json",MediaType.APPLICATION_JSON_UTF8);

    }



}
